package com.campus.counseling.model.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.campus.counseling.entity.TestDimension;
import com.campus.counseling.model.query.TestDimensionQuery;
import com.campus.counseling.model.vo.TestDimensionVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TestDimensionMapper extends BaseMapper<TestDimension> {
    
    Page<TestDimensionVO> selectDimensionVOPage(Page<?> page, @Param("query") TestDimensionQuery query);

    @Select("SELECT * FROM test_dimensions WHERE test_id = #{testId}")
    List<TestDimension> selectByTestId(@Param("testId") Long testId);
    
    /**
     * 获取测试的指定维度
     * @param testId 测试ID
     * @param dimensionKey 维度键值
     * @return 维度信息
     */
    TestDimension selectByDimensionKey(@Param("testId") Long testId, @Param("dimensionKey") String dimensionKey);
    
    /**
     * 批量插入维度
     * @param dimensions 维度列表
     * @return 影响行数
     */
    int batchInsert(@Param("dimensions") List<TestDimension> dimensions);
}